<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script>
			let arr = [{
				id: 1,
				age: 10
			}, {
				id: 2,
				age: 20
			}];
			// map（返回数组中的值			
			let arr1 = arr.map(value => value.age);
			console.log(arr1); // [10, 20]
			
			// reduce()计算数组元素相加后的总和：			
			let arr2 = arr.reduce((num, item) => num + item.age, 0)
			console.log(arr2); // 30
			
			// filter()筛选数组			
			let arr3 = arr.filter(value => value.age == 20);
			console.log(arr3);
		</script>
	</body>
</html>
